package demo.controller;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AdviceTestController {
	
	
	
	
	@RequestMapping("/advicetest")
	public Map<String,Object> advicetest(Date date,@ModelAttribute("globalMessage") String globalMessage) throws Throwable{
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("date",date);
		map.put("globalMessage",globalMessage);

		return map;
		
	}
	
	@RequestMapping("/advicetest2")
	public Map<String,Object> advicetest2(Date date,Model model) throws Throwable{
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("date",date);
		// map.put("globalMessage",model.);
		map.put("model",model.asMap());

		return map;
		
	}
	
	
	
}